package com.cskaoyan.controller;

import com.cskaoyan.bean.BasePageInfo;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.MarketComment;
import com.cskaoyan.bean.MarketGoods;
import com.cskaoyan.bean.leihao.po.CommentDeletePo;
import com.cskaoyan.bean.param.CommonData;
import com.cskaoyan.config.zhangshizhi.CountTime;
import com.cskaoyan.service.CommentService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: leihao
 * @Date: Created in 16:54 2022/6/28
 */
@RestController
@RequestMapping("admin/comment")
public class CommentController {

    @Autowired
    CommentService commentService;

    @CountTime
    @RequiresPermissions(value ={"admin:comment:list","*"},logical = Logical.OR)
    @RequestMapping("list")
    public BaseRespVo<MarketGoods> commentList(BasePageInfo basePageInfo, Integer userId, Integer valueId){
        CommonData<MarketComment> List = commentService.getCommentList(basePageInfo,userId,valueId);
        return BaseRespVo.ok(List);
    }
    @CountTime
    @RequiresPermissions(value ={"admin:comment:delete","*"},logical = Logical.OR)
    @RequestMapping("delete")
    public BaseRespVo commentDelete(@RequestBody MarketComment marketComment){
        commentService.delete(marketComment);
        return BaseRespVo.ok();
    }
}
